@using DNA.Mvc.Text
@model DNA.Mvc.UserProfile
@{  
    Ajax.Dna().Widget()
        .UserPreferences(@<text>
    @if (User.IsAdministrator())
    {
        <div>@Html.Global("RES_USER_NAME")</div>
        <div>@Ajax.Dna().TextBox(item.GenerateFieldID("UserName")).Value(item.GetString("UserName")).GetHtml()</div>
    }
    else
    {
        <input type="hidden" value="@item.GetString("UserName")" name="@item.GenerateFieldID("UserName")" />
    }
    <div>@Html.Global("RES_MODE")</div>
    <div>
        @(
 Ajax.Dna().ComboBox(item.GenerateFieldID("Mode"))
    .Items(items =>
    {
        items.AddValue("Mini");
        items.AddValue("Full");
    })
    .Select(item.GetString("Mode"))
    .GetHtml()
    )
    </div>
    </text>)
        .Content(@<text>
    @if (Model != null)
    { 
        <table style="width: 100%">
            <tr>
                <td style="width: 64px; vertical-align: top; text-align: center;">
                    <div class="ui-corner-all d-avatar" style="display: inline-block;">
                        @if (!string.IsNullOrEmpty(item.GetString("Mode")) && item.GetString("Mode").Equals("Full", StringComparison.OrdinalIgnoreCase))
                        {
                            <img src="@Membership.GetUser(Model.UserName).GetAvatar()" alt="" class="ui-corner-all" />
                        }
                        else
                        {
                            <img src="@Membership.GetUser(Model.UserName).GetAvatar(80)" alt="" class="ui-corner-all" />
                        }
                    </div>
                    <div style="font-size: 300%; padding: 10px;">
                        @Model.Points
                    </div>
                    <div>@Html.Global("RES_POINTS")</div>
                </td>
                <td style="vertical-align: top;">
                    <section style="padding-top: 0px;">
                        <header>
                            @{var _dispName = (!string.IsNullOrEmpty(Model.DisplayName)) ? Model.DisplayName : Model.UserName;}
                            @_dispName
                        </header>
                        @if (!string.IsNullOrEmpty(item.GetString("Mode")) && item.GetString("Mode").Equals("Full", StringComparison.OrdinalIgnoreCase))
                        {
                            <table style="margin-top: 10px; width: 100%;">
                                <tr>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_GENDAR"):
                                    </td>
                                    <td>
                                        @if (string.IsNullOrEmpty(Model.Gendar))
                                        {
                                            @Html.Global("RES_UNKNOW")
                                        }
                                        else
                                        {
                                            if (Model.Gendar.Equals("P", StringComparison.OrdinalIgnoreCase))
                                            { 
                                            @Html.Global("RES_PRIVATE")
                                            }
                                            if (Model.Gendar.Equals("F", StringComparison.OrdinalIgnoreCase))
                                            { 
                                            @Html.Global("RES_FEMALE")
                                            }
                                            if (Model.Gendar.Equals("M", StringComparison.OrdinalIgnoreCase))
                                            {
                                            @Html.Global("RES_MALE")
                                            }
                                        }
                                    </td>
                                    <td style="width: 50px; white-space: nowrap;">
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_REALNAME"):
                                    </td>
                                    <td>@Model.FirstName @Model.LastName
                                    </td>
                                    <td style="width: 50px; white-space: nowrap;">
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_PHONE"):
                                    </td>
                                    <td>
                                        @if (!string.IsNullOrEmpty(Model.Phone))
                                        {
                                            @Model.Phone
                                        }
                                        else
                                        {
                                            <div>
                                                -</div>
                                        }
                                    </td>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_MOBILE"):
                                    </td>
                                    <td>
                                        @if (!string.IsNullOrEmpty(Model.Mobile))
                                        {
                                            @Model.Mobile
                                        }
                                        else
                                        {
                                            <div>
                                                -</div>
                                        }
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_EMAIL"):
                                    </td>
                                    <td>
                                        @if (!string.IsNullOrEmpty(Model.Email))
                                        {
                                            @Model.Email
                                        }
                                        else
                                        {
                                            <div>
                                                -</div>
                                        }
                                    </td>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_WEBSITE"):
                                    </td>
                                    <td>
                                        @if (!string.IsNullOrEmpty(Model.WebSite))
                                        {
                                            <a href="@Model.WebSite" rel="nofollow">@Model.WebSite</a>
                                        }
                                        else
                                        {
                                            <div>
                                                -</div>
                                        }
                                    </td>
                                </tr>
                                <tr>
                                    <td>@Html.Global("RES_FOLLOW_ME")
                                    </td>
                                    <td colspan="3">
                                        <ul class="d-horizontal-list">
                                            <li><a href="http://www.facebook.com/@(Model.Facebook)" target="_blank">
                                                <img src="@Url.Content("~/content/images/icon_facebook_16.png")" alt="facebook" /></a></li>
                                            <li><a href="http://www.twitter.com/@(Model.Twitter)" target="_blank">
                                                <img src="@Url.Content("~/content/images/icon_twitter_16.png")" alt="twitter" /></a></li>
                                            <li><a href="http://www.linkedin.com/@(Model.LinkedIn)" target="_blank">
                                                <img src="@Url.Content("~/content/images/icon_linkedin.gif")" alt="linkedin" /></a></li>
                                            <li><a href="http://plug.google.com/@(Model.GooglePlus)" target="_blank">
                                                <img src="@Url.Content("~/content/images/icon_google_plus.png")" alt="google" /></a></li>
                                            <li><a href="http://www.skype.com/@(Model.Skype)" target="_blank">
                                                <img src="@Url.Content("~/content/images/icon_skype.png")" alt="skype" /></a></li>
                                        </ul>
                                    </td>
                                </tr>
                            </table>
                            @UIHelper.SectionHeader(Html.Global("RES_SIGNATURE"), 3)
                            <p>
                                @if (!string.IsNullOrEmpty(Model.Signature))
                                { 
                                    @TextEngine.SafeHtml(Model.Signature)
                                }
                            </p>
                        }
                        else
                        {    
                            <table>
                                @if (!string.IsNullOrEmpty(Model.Email))
                                {
                                    <tr>
                                        <td>@Html.Global("RES_EMAIL"):
                                        </td>
                                        <td>
                                            <a href="mailto:@Model.Email">Mail me</a>
                                        </td>
                                    </tr>}
                                <tr>
                                    <td style="width: 50px; white-space: nowrap;">@Html.Global("RES_GENDAR"):
                                    </td>
                                    <td>
                                        @if (string.IsNullOrEmpty(Model.Gendar))
                                        {
                                            @Html.Global("RES_UNKNOW")
                                        }
                                        else
                                        {
                                            if (Model.Gendar.Equals("P", StringComparison.OrdinalIgnoreCase))
                                            { 
                                            @Html.Global("RES_PRIVATE")
                                            }
                                            if (Model.Gendar.Equals("F", StringComparison.OrdinalIgnoreCase))
                                            { 
                                            @Html.Global("RES_FEMALE")
                                            }
                                            if (Model.Gendar.Equals("M", StringComparison.OrdinalIgnoreCase))
                                            {
                                            @Html.Global("RES_MALE")
                                            }
                                        }
                                    </td>
                                </tr>
                                @if (!string.IsNullOrEmpty(Model.WebSite))
                                {
                                    <tr>
                                        <td>@Html.Global("RES_WEBSITE"):
                                        </td>
                                        <td>
                                            <a href="@Model.WebSite" rel="nofollow">@Html.Global("RES_MORE")</a>
                                        </td>
                                    </tr>
                                }
                            </table>
                            <p>
                                @if (!string.IsNullOrEmpty(Model.Signature))
                                { 
                                    @TextEngine.SafeHtml(Model.Signature)
                                }
                            </p>
                            <footer>
                                <ul class="d-horizontal-list">
                                    <li><a href="http://www.facebook.com/@(Model.Facebook)" target="_blank">
                                        <img src="@Url.Content("~/content/images/icon_facebook_16.png")" alt="facebook" /></a></li>
                                    <li><a href="http://www.twitter.com/@(Model.Twitter)" target="_blank">
                                        <img src="@Url.Content("~/content/images/icon_twitter_16.png")" alt="twitter" /></a></li>
                                    <li><a href="http://plug.google.com/@(Model.LinkedIn)" target="_blank">
                                        <img src="@Url.Content("~/content/images/icon_linkedin.gif")" alt="linkedin" /></a></li>
                                    <li><a href="http://plug.google.com/@(Model.GooglePlus)" target="_blank">
                                        <img src="@Url.Content("~/content/images/icon_google_plus.png")" alt="google" /></a></li>
                                    <li><a href="http://www.skype.com/@(Model.Skype)" target="_blank">
                                        <img src="@Url.Content("~/content/images/icon_skype.png")" alt="skype" /></a></li>
                                </ul>
                            </footer>
                        }
                    </section>
                </td>
            </tr>
        </table>
    }
    else
    { 
        <div style="padding: 10px;">
            You are not login yet.
            @Html.ActionLink("Register", "Register", "Account", new { Area = "" }, null)
            or
            @Html.ActionLink("Login", "Login", "Account", new { Area = "" }, null)
            now.
        </div>
    }
    </text>)
.Preview(@<text>
    <table style="width: 100%">
        <tr>
            <td align="center" colspan="2">
                <h4 style="padding: 5px;">
                    User name
                </h4>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <img src="@Url.Content("~/content/images/no-avatar.gif")" alt="" class="ui-corner-all" />
            </td>
        </tr>
        <tr>
            <td style="min-width: 80px;">
                @Html.Global("RES_LOCATION"):
            </td>
            <td>
                USA
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_REGISTERED"):
            </td>
            <td>
                @Html.Global(DateTime.Now)
            </td>
        </tr>
        <tr>
            <td style="white-space: nowrap;">
                @Html.Global("RES_LAST_LOGIN"):
            </td>
            <td>
                @Html.Global(DateTime.Now)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <ul class="ui-helper-reset">
                    <li style="float: left; padding: 1px;"><a target="_blank" href="http://www.dotnetage.com">
                        <span class="forum-icon forum-icon-web"></span></a></li>
                    <li style="float: left; padding: 1px;"><a target="_blank" href="#"><span class="forum-icon forum-icon-msn">
                    </span></a></li>
                    <li style="float: left; padding: 1px;"><a target="_blank" href="#"><span class="forum-icon forum-icon-yahoo">
                    </span></a></li>
                    <li style="float: left; padding: 1px;"><a target="_blank" href="javascript:void(0);">
                        <span class="forum-icon forum-icon-email"></span></a></li>
                    <li style="float: left; padding: 1px;"><a target="_blank" href="#"><span class="forum-icon forum-icon-blog">
                    </span></a></li>
                    <li style="float: left; padding: 1px;"><a target="_blank" href="#"><span class="forum-icon forum-icon-icq">
                    </span></a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                Here is user signature
            </td>
        </tr>
    </table>
    </text>)
        .Render();
}
